package com.yckj.day09;

/**
 * TODO 测试
 *
 * @author shengyuee
 * @version 1.0
 * 2025/7/28 15:26
 */
public class WorkerTest {
    public static void main(String[] args) {
        Doctor doctor = new Doctor();
        Teacher teacher = new Teacher();
        Cleaner cleaner = new Cleaner();
        // 向上转型
        Worker worker1 = doctor;
        Worker worker2 = teacher;
        Worker worker3 = cleaner;
        Worker[] workers = {worker1,worker2,worker3};
        for (Worker worker:workers) {
           worker.work();
        }
    }
}
